#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
using namespace std;
class Solution {
    string _numToStr[10] = { "","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz" };
public:
    void Combinations(const string& digits, size_t di, string combineStr, vector<string>& strV) {
        if (di == digits.size()) {
            strV.push_back(combineStr);
            return;
        }
        int num = digits[di] - '0';
        string str = _numToStr[num];
        for (auto ch : str) {
            Combinations(digits, di + 1, combineStr + ch, strV);
        }

    }
    vector<string> letterCombinations(string digits) {
        vector<string> strV;
        if (digits.size() == 0)
            return strV;
        Combinations(digits, 0, "", strV);
        return strV;
    }
};
int main() {
    Solution sol;
    string digits = "234"; 
    vector<string> result = sol.letterCombinations(digits); 
    for (string str : result) { 
        cout << str << " ";
    } 
    cout << endl;
    return 0;
}